﻿Public Class ctrTraCuuBan

    Private Sub ctrTraCuuBan_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        rdTatCa.Checked = True
        gvBan_Load()
    End Sub

    Private Sub gvBan_Load()
        Dim bus As BanBUS = New BanBUS()
        gvBan.DataSource = bus.GetTable()
    End Sub

    Private Sub btnThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThoat.Click
        frmMain.TabControl1.TabPages.Remove(frmMain.TabControl1.SelectedTab)
    End Sub

    Private Sub rdTrong_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdTrong.CheckedChanged
        Dim bus As GeneralBUS = New GeneralBUS()
        gvBan.DataSource = bus.GetTable("select * from BAN where TinhTrang='Trống'")
    End Sub

    Private Sub rdDat_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdDat.CheckedChanged
        Dim bus As GeneralBUS = New GeneralBUS()
        gvBan.DataSource = bus.GetTable("select * from BAN where TinhTrang='Đặt'")
    End Sub

    Private Sub rdDay_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdDay.CheckedChanged
        Dim bus As GeneralBUS = New GeneralBUS()
        gvBan.DataSource = bus.GetTable("select * from BAN where TinhTrang='Đầy'")
    End Sub

    Private Sub rdTatCa_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdTatCa.CheckedChanged
        gvBan_Load()
    End Sub
End Class
